package nl.Viewer.SerializedObjects;

import java.awt.Dimension;

/**
 * A DataObject contains the definition of a dataObject on the server side
 * 
 * @author Jeroen Verschuur
 *
 */

public class DataObject {
   public final String           dataType;
   public final Dimension[]      resolutionParts;
   public final Bounds           bounds;
   public final int              tilesize;

   public DataObject( String dataType, Dimension[] resolutionParts, Bounds bounds, int tilesize ) {
      super();
      this.dataType = dataType;
      this.resolutionParts = resolutionParts;
      this.bounds = bounds;
      this.tilesize = tilesize;
   }

   public int getTilesize() {
      return tilesize;
   }

   public Bounds getBounds() {
      return bounds;
   }


   public String getDataType() {
      return dataType;
   }


   public int[] getPartCount( int resolution ) {
      if( resolution >= resolutionParts.length ) {
         return new int[]{0, 0};
      }
      return new int[] { resolutionParts[resolution].width, resolutionParts[resolution].height };
   }

   public int getResolutionLevelCount() {
      return resolutionParts.length;
   }

   public Dimension[] getResolutionParts() {
      return resolutionParts;
   }

   public boolean isSinglePart() {
      return( getResolutionLevelCount() == 1 && resolutionParts[0].height == 1 && resolutionParts[0].width == 1 );
   }

}
